package org.goldenport.g3.drivers

import org.goldenport.util.QSymbol
import org.goldenport.g3._
import org.goldenport.g3.messages._
import org.goldenport.g3.messages.http
import org.goldenport.g3.events._

/**
 * @since   Sep. 21, 2010
 * @version Sep. 30, 2010
 * @author  ASAMI, Tomoharu
 */
@deprecated("unused")
class PortDriver(val uri: String, val encoding: String = "utf-8", val mime: Option[String] = None) extends G3Driver {
  override protected def driver_Activity(ctx: G3AgentContext): PartialFunction[AnyRef, AnyRef] = {
    case cmd: G3Command => execute(cmd, ctx)
  }

  protected def new_Agent(cmd: G3Command, ctx: G3AgentContext): PortDriverAgent = {
    new PortDriverAgent(uri, encoding, mime, ctx)
  }
}

class PortDriverAgent(uri: String, val encoding: String, val mime: Option[String], context: G3AgentContext) extends G3DriverAgent(uri, context) {
  val gDataSource = context.getDataSource(uri)

  agent {
    case cmd: http.GET => http_get(cmd)
    case cmd: http.PUT => http_put(cmd)
    case cmd: http.POST => http_post(cmd)
    case cmd: http.DELETE => http_delete(cmd)
    case cmd: http.MKCOL => http_mkcol(cmd)
    case cmd: http.COPY => http_copy(cmd)
    case cmd: http.MOVE => http_move(cmd)
  }

  //
  def get(get: Get): G3Event = {
    error("")
  }

  def post(post: Post): G3Event = {
    error("")
  }

  def put(put: Put): G3Event = {
    error("")
  }

  def delete(delete: Delete): G3Event = {
    error("")
  }

  def mkcol(mkcol: Mkcol): G3Event = {
    error("")
  }

  def http_get(get: http.GET): G3Event = {
    error("")
  }

  def http_post(post: http.POST): G3Event = {
    error("")
  }

  def http_put(put: http.PUT): G3Event = {
    error("")
  }

  def http_delete(delete: http.DELETE): G3Event = {
    error("")
  }

  def http_mkcol(mkcol: http.MKCOL): G3Event = {
    error("")
  }

  def http_copy(copy: http.COPY): G3Event = {
    error("")
  }

  def http_move(move: http.MOVE): G3Event = {
    error("")
  }
}

